using System;
using System.Collections.Generic;
using System.Text;

namespace Utilities.Common
{
    #region Attibutes for Properties
    /// <summary>
    /// Indica que este campo es el Identificador del Elemento.
    /// </summary>
    [global::System.AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
    public sealed class IsIdAttribute : Attribute { }

    /// <summary>
    /// Indica que no se debe guardar el campo.
    /// </summary>
    [global::System.AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
    public sealed class NotSaveAttribute : Attribute { }


    /// <summary>
    /// Guarda la propiedad en el campo indicado. 
    /// </summary>
    [global::System.AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
    public sealed class FieldAttribute : Attribute
    {
        readonly string _fieldName;

        public FieldAttribute(string fieldName)
        {
            this._fieldName = fieldName;
        }

        public string FieldName
        {
            get
            {
                return this._fieldName;
            }
        }
    } 
    #endregion
    
    #region  Attributes for Classes
    [global::System.AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
    public sealed class TableNameAttribute : Attribute
    {
        readonly string _positionalString;

        public TableNameAttribute(string pTable)
        {
            this._positionalString = pTable;
        }
        public string TableName
        {
            get
            {
                return this._positionalString;
            }
        }
    }

    /// <summary>
    /// Indica el prefijo que se utiliza en la base de datos. Se utiliza para armar los parametros. Agregar el guion bajo si corresponde.
    /// </summary>
    [global::System.AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
    public sealed class FieldPrefixAttribute : Attribute
    {
        readonly string positionalString;

        public FieldPrefixAttribute(string prefix)
        {
            this.positionalString = prefix;
        }

        public string Prefix
        {
            get { return positionalString; }
        }
    }
    #endregion
}
